<?php
// 获取数据库提交的申请

$page = @$_GET['page'] - 1;
if ($page < 0){
	$page = 0;
}
$count = @$_GET['count'];
if (!$count){
	$count = 5;
}

$data = array();
$sql = "SELECT lid,flink,sitename,name,phone,status,apply_time,end_time FROM `flink_tb`LIMIT ".($page*$count).','.$count;
if (!my_mysql_query($sql, $data)){
	show_msg(1,'数据查询失败', 3, 'index.php?action='.$action);
	exit();
}

$sum = array();
$sql = "SELECT count(lid) as count FROM `flink_tb` ;";
if (!my_mysql_query($sql, $sum)){
	show_msg(1,'数据查询失败', 3, 'index.php?action='.$action);
	exit();
}

?>
<style type="text/css">
#table{
	text-align: center;
}
#table td,#table th{
	padding: 0 15px;
	border-bottom: 1px solid rgb(210,210,210);
}
#table td button {
	width: 79px;
	height: 32px;
	color: white;
	border: none;
	outline: none;
	cursor: pointer;
	font-size: 14px;
	background: url(image/agree.png) 0 0 no-repeat;
}
</style>

<table id="table" cellspacing="0">
	<caption><h1>申请状态的连接</h1></caption>
	<tr>
		<th>申请id</th>
		<th>申请人</th>
		<th>申请电话</th>
		<th>网站名称</th>
		<th>申请时间</th>
		<th>截止时间</th>
		<th>是否加入</th>
	</tr>
	
	<?php
	foreach($data as $flink){
		echo '<tr>';
		echo '<td>'.$flink['lid'].'</td>';
		echo '<td>'.$flink['name'].'</td>';
		echo '<td>'.$flink['phone'].'</td>';
		echo '<td> <a href="'.$flink['flink'].'">'.$flink['sitename'].'</a></td>';
		echo '<td>'.date('Y-m-d',$flink['apply_time']).'</td>';
		echo '<td>'.date('Y-m-d',$flink['end_time']).'</td>';
		echo '<td>'.($flink['status']==1?'是':'否').'</td>';
		
		echo '</tr>';
	}

	?>
</table>

<div>
	<form action="index.php" method="GET">
	<input type="hidden" name="action" value="<?php echo $action; ?>">
	共有<span style="color:red"><?php echo $sum[0]['count']; ?></span>条数据,
	每页<span style="color:red"><input type="text" name="count" size="5" value="<?php echo $count; ?>"></span>条数据,
	当前第<span style="color:red"><?php echo ($page+1); ?></span>页,
	跳到<input type="text" name="page" value="<?php echo ($page+2); ?>" size="3">页
	<button type="submit" name="secondAction" value="search">GO</button>
	</form>
</div>
